<html>
<head>
<title>300px Body</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<style type="text/css">
<!--
.style1 {
	color: #CCCCCC;
	font-weight: bold;
}
.style2 {color: #000000}
-->
.error_strings{ font-family:Verdana; font-size:14px; color:#660000;}
</style>
<link href="../admin/logic/validation/border.css" rel="stylesheet" type="text/css">
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<!-- ImageReady Slices (300px Body.jpg) -->
<script language="JavaScript" src="../admin/logic/validation/validation.js" type="text/javascript"></script>
 <script language="JavaScript" src="validation/parent_payment_search.js" type="text/javascript"></script>


<?php

       include'../admin/logic/Classes/db.php'; 

        $x=new Dbconnect();
	
	    $con=$x->getConnection();
		$user=$_SESSION['user'];
	    
		 //getting emplyee or registration number using User name
	    $result1=mysql_query("select emp_reg from login where u_name='$user'",$con);
		
		while($row1=mysql_fetch_array($result1)){
		 $emp_reg=$row1['emp_reg'];
         }
		 
		 //getting student name using Registration number
		 
		 $result2=mysql_query("select l_name,f_name from student where reg_no='$emp_reg'",$con);
		 
		 while($row2=mysql_fetch_array($result2)){
		 $first=$row2['f_name'];
		 $last=$row2['l_name'];
         }
		 
		 $full_name=$first." ".$last;
		 
		 $time_now=mktime(date('H')+5,date('i')+30,date('s'),date('m'),date('d'),date('Y'));
		 
		 include'../admin/logic/Classes/paymentHandler.php'; 
		 
		
		 $startrow="0";
		 $limit="15";
		 $pid="reg";
		 $mon=date('m',$time_now);
		
		if(isset($_POST['Submit'])){
		 
		 $mon=$_POST['sltMon'];
		 } 
		  
		  
		  $pay=new PaymentHandler();
		  $pay->setConnect($con);
		  $result=$pay->getSearch($startrow,$emp_reg,$pid,$mon,$limit);
		  $num=mysql_num_rows($result);
		  
		?>
       
<table width="800" height="173" border="0" align="center" cellpadding="0" cellspacing="0" id="Table_01">
	<tr>
		<td>
			<img src="images/pay_search.gif" width="800" height="69" alt=""></td>
	</tr>
	<tr >
	  <td height="64" background="images/2.gif" style="background-repeat:repeat-y"><form method="post" action="parent_home.php" onSubmit="return validate()"><table width="799" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="112">&nbsp;</td>
          <td width="75"><strong>Search</strong> </td>
          <td width="114"><select name="sltMon" id="sltMon">
            
           <option value="Select" selected="selected">Month</option>
            <option value="1">January</option>
            <option value="2">February</option>
            <option value="3">March</option>
            <option value="4">April</option>
            <option value="5">May</option>
            <option value="6">June</option>
            <option value="7">July</option>
            <option value="8">August</option>
            <option value="9">September</option>
            <option value="10">October</option>
            <option value="11">November</option>
            <option value="12">December</option>
          </select></td>
          <td width="10">&nbsp;</td>
          <td width="52"><input name="Submit" type="submit" id="Submit" value="Go"></td>
          <td width="107"><div align="center">Student Name : </div></td>
          <td width="329"><div align="left" class="error_strings" ><?php echo $full_name;  ?></div></td>
        </tr>
		</table>
		</form>
		&nbsp;
		<?php if(!($num==0)){  ?>
		<table width="600" height="79" border="1" align="center" cellpadding="0" cellspacing="0" class="table1">
          <tr bgcolor="#003468"> 
            <td width="104" height="27"><div align="center" class="style1">Payment Id</div></td>
            <td width="99"><div align="center" class="style1">Reg_no</div></td>
            <td width="100"><div align="center" class="style1">Subject</div></td>
            <td width="92"><div align="center" class="style1">Grade</div></td>
            <td width="100"><div align="center" class="style1">Amount</div></td>
            <td width="105"><div align="center"><span class="style1">Month</span></div></td>
          </tr>
		  
		  
		  
		  
		<?php 
	        
		$x=0;
	    while($row=mysql_fetch_array($result)) {  //loop starting point   
	   
	    if($row['date']==1){
		$month="January";
		}else if($row['date']==2){
		  $month="February";
		}else if($row['date']==3){
		  $month="March";
		}else if($row['date']==4){
		  $month="April";
		}else if($row['date']==5){
		  $month="May";
		}else if($row['date']==6){
		  $month="June";
		} else if($row['date']==7){
		$month="July";
		}else if($row['date']==8){
		  $month="August";
		}else if($row['date']==9){
		  $month="September";
		}else if($row['date']==10){
		  $month="October";
		}else if($row['date']==11){
		  $month="November";
		}else if($row['date']==12){
		  $month="December";
		}
		  
			 
			 
		?>
			 
			 <?php if($x%2==0){ ?> 
          <tr bgcolor="#DDDDDD" >
            <td height="24"><div align="center" class="style2"><?php echo $row['payment_id']; ?></div></td>
            <td><div align="center" class="style2"><?php echo $row['reg_no']; ?></div></td>
            <td><div align="center" class="style2"><?php echo $row['subject']; ?></div></td>
            <td><div align="center" class="style2"><?php echo $row['grade']; ?></div></td>
            <td><div align="center" class="style2"><?php echo $row['p_fee']; ?></div></td>
            <td><div align="center" class="style2"><?php echo $month;; ?></div></td>
          </tr><?php } else { ?>
		  <tr>
            <td height="23"><div align="center"><?php echo $row['payment_id']; ?></div></td>
            <td><div align="center"><?php echo $row['reg_no']; ?></div></td>
            <td><div align="center"><?php echo $row['subject']; ?></div></td>
            <td><div align="center"><?php echo $row['grade']; ?></div></td>
            <td><div align="center"><?php echo $row['p_fee']; ?></div></td>
            <td><div align="center"><?php echo $month; ?></div></td>
		  
		  <?php } $x=$x+1;}  ?>
        </table>
		<?php } else { ?><div align="center"> <strong> There is no payment record to display in this month </strong></div><?php } ?>
		
    
	</tr></td>
	</tr>
	<tr>
		<td>
			<img src="images/3.gif" width="800" height="40" alt=""></td>
	</tr>
</table>


<!-- End ImageReady Slices -->
</body>
</html>